home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: grantp@usa.pipeline.com(Pete Grant)
- Newsgroups: comp.lang.c++
- Subject: Re: Drawing from any procedure
- Date: 23 Mar 1996 03:50:31 GMT
- Organization: Pipeline USA
- Message-ID: <4ivse7$3p1@news1.h1.usa.pipeline.com>
- References: <4iuni1$oep@lily.csv.warwick.ac.uk>
- NNTP-Posting-Host: 38.8.61.11
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete Grant)
- X-Newsreader: Pipeline v3.5.0
-
- On Mar 22, 1996 17:21:05 in article <Drawing from any procedure>,
- 'esuvx@csv.warwick.ac.uk (Adge)' wrote:
-
-
- >
- >I am programming in ms Visual C++ v.4.0 under Win95, and am trying to
- >persuade it to allow me to draw graphics to a window from a procedure
- other
- >than OnPaint or OnDraw.
- >
- >I have tried using CPaintDC(this); , but this gives an access violation.
- >
- >It used to be possible under Borland Pascal for win but I can't work out
- >how to do it under visc++
- >
- >Can anyone help ?
- >
- This really belongs to comp.os.ms-windows.programmer.tools.mfc, but
- since we're here...
-
- CPaintDC can be used only in functions called in response to
- WM_PAINT messages; e.g., OnPaint. If you wish to to GDI output at
- any other time, you need to use CDC instead. Alternately, you
- can switch to raw API:
-
- HDC hDC = ::GetDC(m_hWnd);
- ... do your drawing,,,
- ::ReleaseDC(m_hWnd, hDC);
-
- --
-
- Pete Grant
- Kalevi, Inc.
- Sofware Engineering
-